/**
 * Created by jiabin.yu on 2018/9/22.
 */
import { Template } from 'meteor/templating';


Template.Result.helpers({

    tableSettings: function () {
        if(Template.instance().data){
            var resumeLib=ResumeLib.findOne({companyId:Meteor.userId()});
            if(resumeLib){

                return {
                    collection:resumeLib.ResumeIds,
                    rowsPerPage: 5,
                    showFilter: true,
                    fields: [
                        ,
                        {
                            key:'resume_Id',
                            label:'简历',
                            fn:function (value,obj,key) {
                                // console.log(obj.view)
                                var resumes=Seekresume.findOne({ownerId:value});
                                return  new Spacebars.SafeString(

                                    '<ul class="resumeDetails list-group">'+
                                    '<li class="list-group-item resumeDetails" style="width: 140px">'+
                                    '<span class="enterpriseResume-item">'+
                                    resumes.name+
                                    '</span>'+
                                    '姓名'+
                                    '</li>'+
                                    '<li class="list-group-item resumeDetails" style="width: 140px">'+
                                    '<span class="enterpriseResume-item">'+
                                    resumes.age+
                                    '</span>'+
                                    '年龄'+
                                    '</li>'+
                                    '<li class="list-group-item resumeDetails" style="width: 140px">'+
                                    '<span class="enterpriseResume-item">'+
                                    resumes.year+
                                    '</span>'+
                                    '经验'+
                                    '</li>'+
                                    '</ul>'

                                )
                            },
                            sortable: false
                        },
                        {
                            key:'time',
                            label:'投递时间（最近一次）',
                            fn:function (value, obj, key) {

                                return  new Spacebars.SafeString(

                                    '<ul class="list-group">'+
                                    '<li class="list-group-item" style="width: 140px">'+
                                    new Date(value).toLocaleDateString().replace(/\//g, "-") + " " + new Date(value).toTimeString().substr(0, 8)
                                    +
                                    '</li>'+
                                    '</ul>'

                                )
                            },
                            sortable: false
                        }
                    ],
                }
            }else {
                return []
            }

        }else {
            return []
        }

    }

});
